package com.lebang.feign;

import com.lebang.feign.fallback.BookTimeFallback;
import com.lebang.model.RequestUserInfo;
import com.lebang.model.back.Result;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ljx
 */
@FeignClient(name = "wangzhuan-earns", contextId = "wangzhuan-earns-bookTime",fallback = BookTimeFallback.class)
public interface BookTimeFeign {

    /**
     * 获取听书时长阶段配置信息
     * @param request
     * @return
     */
    @PostMapping("/app/book/timeConfig/list")
    JsonData configList(@RequestBody RequestUserInfo request);

    /**
     * 听书时长配置记录添加
     * @param request
     * @param configId
     * @return
     */
    @PostMapping("/app/book/timeConfig/addDataRecord")
    Result<Integer> bookTimeData(@RequestBody RequestUserInfo request,@RequestParam("configId") Integer configId);

    @PostMapping("/app/book/time/pull")
    Result<Integer> bookTimePull(@RequestBody RequestUserInfo request,@RequestParam("recordId") Integer recordId);

    /**
     * 听书时长记录添加
     *
     * @param request
     * @param time
     * @return
     */
    @PostMapping("/app/book/add/bookTime")
    JsonData addTimeRecord(@RequestBody RequestUserInfo request,
                                  @ApiParam(name = "时长") @RequestParam("time") Long time,
                                  @ApiParam(name = "听书id") @RequestParam("time") String bookId);

    /**
     * 获取今日听书时长
     *
     * @param request
     * @return
     */
    @PostMapping("/app/book/get/bookTime")
    JsonData getBookTime(@RequestBody RequestUserInfo request);
}
